/**
 *@program: getx_simple_code
 *@description:
 *@author: Ming
 *@create: 2023-12-28 14:04
 *@version v1.0
 */
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_simple_code/common/routes/app_routes.dart';

class RouteAuthMiddleware extends GetMiddleware {
  @override
  int? priority=0;//优先级越低越先执行

  RouteAuthMiddleware({required this.priority});

  @override
  RouteSettings? redirect(String? route) {
    print("route=${route}");
    if(1>1){
      return null;
    }else{
      Future.delayed(Duration(seconds: 1), () => Get.snackbar("提示", "请先登录APP"));
      return RouteSettings(name: AppRoutes.Login);
    }

  }
}